<?php

declare(strict_types=1);

/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

use App\Controller\WxLoginController;
use App\Controller\WxUserController;
use App\Middleware\WxAuthMiddleware;
use Hyperf\HttpServer\Router\Router;

Router::get('/favicon.ico', function () {
    return '';
});

Router::addGroup('/api/v1/', function () {
    /** 无需校验 手机号 ！ */
    Router::post('wx/user/from', [WxUserController::class, 'updateFrom']);
    Router::post('wx/user/phone', [WxLoginController::class, 'updatePhone']);
}, ['middleware' => [WxAuthMiddleware::class]]);

Router::addGroup('/api/v1/', function () {
    Router::post('wx/user/{code}', [WxLoginController::class, 'index']);
});

Router::addRoute(['GET', 'POST', 'HEAD'], '/test', 'App\Controller\IndexController@test');